#define NOTASKDIALOG //This is required to ensure we do not pull in the Windows definition of TaskDialog(Indirect). Also note
                     //for this to work, precompiled headers must be turned off for this compilation unit

#include "stdafx.h"
#include "resource.h"
#include "..\XTaskDialog.h"
#include "..\XTaskDialogClient.h"


class CXTaskDialogDLLModule : public CAtlDllModuleT<CXTaskDialogDLLModule>
{
};

CXTaskDialogDLLModule _AtlModule;


//DLL Entry Point
extern "C" BOOL WINAPI DllMain(HINSTANCE /*hInstance*/, DWORD dwReason, LPVOID lpReserved)
{
  return _AtlModule.DllMain(dwReason, lpReserved); 
}

//Our exported version of "TaskDialogIndirect"
extern "C" HRESULT __stdcall TaskDialogIndirect(const TASKDIALOGCONFIG* pTaskConfig, int* pnButton, int* pnRadioButton, BOOL* pfVerificationFlagChecked)
{
  CXTaskDialog dlg;
  return dlg.TaskDialogIndirect(pTaskConfig, pnButton, pnRadioButton, pfVerificationFlagChecked);
}

//Our exported version of "TaskDialog"
extern "C" HRESULT __stdcall TaskDialog(HWND hWndParent, HINSTANCE hInstance, PCWSTR pszWindowTitle, PCWSTR pszMainInstruction, PCWSTR pszContent, TASKDIALOG_COMMON_BUTTON_FLAGS dwCommonButtons, PCWSTR pszIcon, int* pnButton)
{
  TASKDIALOGCONFIG tc;
  memset(&tc, 0, sizeof(TASKDIALOGCONFIG));
  tc.cbSize = sizeof(TASKDIALOGCONFIG);
  tc.hwndParent = hWndParent;
  tc.hInstance = hInstance;
  tc.pszWindowTitle = pszWindowTitle;
  tc.pszMainInstruction = pszMainInstruction;
  tc.pszContent = pszContent;
  tc.dwCommonButtons = dwCommonButtons;
  tc.pszMainIcon = pszIcon;
  return TaskDialogIndirect(&tc, pnButton, NULL, NULL);
}
